{% extends "base.html" %}

{#submit_list  approve_list)#}

{% block left_content %}
    <ul class="nav nav-pills nav-stacked ">
        <li class="active">
            <a href="#draft_list" data-toggle="pill">草稿箱  <span class="badge">{{ draft_list | length or ''}}</span> </a>
        </li>
        <li class="">
            <a href="#submit_list" data-toggle="pill">我提交的表单 <span class="badge">{{ submit_list | length or '' }}</span></a>
        </li>
        <li class="">
            <a href="#pending_list" data-toggle="pill">待处理 <span class="badge">{{ pending_list | length or '' }}</span></a>
        </li>
        <li class="">
            <a href="#processed_tasks" data-toggle="pill">我处理的表单 <span class="badge">{{ processed_tasks | length or '' }}</span></a>
        </li>

    </ul>
{% endblock %}

{% block main_content %}
    <div class="tab-content vertical-tab-content">
        <div role="tabpanel" class="tab-pane active" id="draft_list">
            {% if draft_list %}

                <table class="table table-bordered" style="width: 100%">
                    <thead>
                    <tr>
                        <th>Task ID</th>
                        <th>流程名称</th>
                        <th>提交人</th>
                        <th>状态</th>
                        <th>提交日期</th>
                        {#                    <th>到达日期</th>#}
                    </tr>
                    </thead>
                    <tbody>
                    {% for item in draft_list %}
                        <tr>
                            <td><a href="/flow/form_view/{{ item.tid }}">{{ item.tid }}</a></td>
                            <td>{{ item.flow.name }}</td>
                            <td>{{ item.user.account }}({{ item.user.name }})</td>
                            <td>{{ task_status(item.status) }}</td>
                            <td>{{ item.create_date }}</td>
                            {#                        <td>{{ item.create_date }}</td>#}
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>

            {% else %}
                <div class="jumbotron">
                    <h3>没有数据</h3>
                    <p>&nbsp;</p>
                </div>
            {% endif %}
        </div>
        <div role="tabpanel" class="tab-pane" id="submit_list">
            {% if submit_list %}

                <table class="table table-bordered" style="width: 100%">
                    <thead>
                    <tr>
                        <th>Task ID</th>
                        <th>流程名称</th>
                        <th>提交人</th>
                        <th>状态</th>
                        <th>提交日期</th>
                        <th>完成日期</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for item in submit_list %}
                        <tr>
                            <td><a href="/flow/form_view/{{ item.tid }}">{{ item.tid }}</a></td>
                            <td>{{ item.flow.name }}</td>
                            <td>{{ item.task.user.account }}({{ item.task.user.name }})</td>
                            <td>{{ task_status(item.task.status) }}</td>
                            <td>{{ item.task.create_date }}</td>
                            <td>{{ item.task.complete_date }}</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>

            {% else %}
                <div class="jumbotron">
                    <h3>没有数据</h3>
                    <p>&nbsp;</p>
                </div>
            {% endif %}
        </div>
        <div role="tabpanel" class="tab-pane" id="pending_list">
            {% if pending_list %}

                <table class="table table-bordered" style="width: 100%">
                    <thead>
                    <tr>
                        <th>Task ID</th>
                        <th>流程名称</th>
                        <th>提交人</th>
                        <th>状态</th>
                        <th>提交日期</th>
                        <th>到达日期</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for item in pending_list %}
                        <tr>
                            <td><a href="/flow/form_view/{{ item.tid }}">{{ item.tid }}</a></td>
                            <td>{{ item.flow.name }}</td>
                            <td>{{ item.task.user.account }}({{ item.task.user.name }})</td>
                            <td>{{ task_status(item.task.status) }}</td>
                            <td>{{ item.task.create_date }}</td>
                            <td>{{ item.create_date }}</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>

            {% else %}
                <div class="jumbotron">
                    <h3>没有数据</h3>
                    <p>&nbsp;</p>
                </div>
            {% endif %}
        </div>
        <div role="tabpanel" class="tab-pane" id="processed_tasks">
            {% if processed_tasks %}

                <table class="table table-bordered" style="width: 100%">
                    <thead>
                    <tr>
                        <th>Task ID</th>
                        <th>流程名称</th>
                        <th>提交人</th>
                        <th>状态</th>
                        <th>提交日期</th>
                        <th>到达日期</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for item in processed_tasks %}
                        <tr>
                            <td><a href="/flow/form_view/{{ item.tid }}">{{ item.tid }}</a></td>
                            <td>{{ item.flow.name }}</td>
                            <td>{{ item.user.account }}({{ item.user.name }})</td>
                            <td>{{ task_status(item.status) }}</td>
                            <td>{{ item.create_date }}</td>
                            <td>{{ item.complate_date }}</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>

            {% else %}
                <div class="jumbotron">
                    <h3>没有数据</h3>
                    <p>&nbsp;</p>
                </div>
            {% endif %}
        </div>
    </div>
{% endblock %}